package com.yjd.bi.user.dao.impl;

import com.yjd.bi.user.dao.IInvestUserStatisticsDao;
import com.yjd.bi.user.model.InvestUserStatisticsModel;
import com.yjd.comm.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * <b>description</b>：用户投资分布情况统计数据访问层 <br>
 * <b>time</b>：2016-04-27 13:25:05 <br>
 * <b>author</b>： zhoujin
 */
@Component("investUserStatisticsDao")
public class InvestUserStatisticsDaoImpl extends BaseDaoImpl implements IInvestUserStatisticsDao {

	private static final String SQLMAPNAMESPACE = InvestUserStatisticsModel.class.getName();
	private static final String PKNAME = "statistical_date";

	@Override
	public String getPrimaryKeyName() {
		return PKNAME;
	}

	@Override
	public String getSqlmapNamespace() {
		return SQLMAPNAMESPACE;
	}
	
	@Override
	public double getFundsSum(Map<String, Object> paramMap, boolean b) {
		Object myObject = this.getSqlMap(b).queryForObject(this.getStatement("usersSum"),paramMap);
		if (myObject != null) {
			return Double.parseDouble(myObject.toString());
		}
		return 0.00D;
	}

	@Override
	public double getSleepUser(Map<String, Object> paramMap, boolean b) {
		Object myObject = this.getSqlMap(b).queryForObject(this.getStatement("getSleepUser"),paramMap);
		if (myObject != null) {
			return Double.parseDouble(myObject.toString());
		}
		return 0.00D;
	}
}
